package com.kly.sc.api.application.controller.im.request;

import com.fqgj.common.api.ParamsObject;
import com.kly.sc.api.infras.exception.ApplicationException;
import com.kly.sc.api.infras.utils.StringUtils;

import java.util.Objects;

public class OpenChatReq extends ParamsObject {

    private static final long serialVersionUID = 4266907681771970025L;
    private String userCodeFriend;
    /**
     * 1-打开私聊页面 2-离开私聊页面
     */
    private Integer type;


    /**
     * 发送消息数量
     */
    private int sendMessagesNumber;

    public String getUserCodeFriend() {
        return userCodeFriend;
    }

    public void setUserCodeFriend(String userCodeFriend) {
        this.userCodeFriend = userCodeFriend;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public int getSendMessagesNumber() {
        return sendMessagesNumber;
    }

    public void setSendMessagesNumber(int sendMessagesNumber) {
        this.sendMessagesNumber = sendMessagesNumber;
    }

    @Override
    public void validate() {
        if (StringUtils.isEmpty(this.userCodeFriend)) {
            throw new ApplicationException("The parameter [userCodeFriend] should not be empty");
        }
        if (Objects.isNull(this.type)) {
            throw new ApplicationException("The parameter [type] should not be empty");
        }

    }
}
